/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.fee.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.fee.entity.Detail;
import com.jeeplus.modules.fee.mapper.DetailMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 计费明细Service
 * @author weisong
 * @version 2017-09-22
 */
@Service
@Transactional(readOnly = true)
public class DetailService extends CrudService<DetailMapper, Detail> {

	public Detail get(String id) {
		return super.get(id);
	}
	
	public List<Detail> findList(Detail detail) {
		return super.findList(detail);
	}
	
	public Page<Detail> findPage(Page<Detail> page, Detail detail) {
		return super.findPage(page, detail);
	}
	
	@Transactional(readOnly = false)
	public void save(Detail detail) {
		super.save(detail);
	}
	
	@Transactional(readOnly = false)
	public void delete(Detail detail) {
		super.delete(detail);
	}

	// 根据id更新状态
	@Transactional(readOnly = false)
	public int updateStatusById(@Param("status") Integer status, @Param("id") String id){
		if(status== Detail.updateStatus){//计费明细改为已结算状态，需将该明细存储到已结算的明细表中

		}
		return mapper.updateStatusById(status, id);
	}

	//根据idNumber 和 状态统计
	public int countByIdNumberAndStatus(String idNumber,Integer status){
		return mapper.countByIdNumberAndStatus(idNumber,status);
	}

	//根据idNumber删除
	@Transactional(readOnly = false)
	public void deleteByIdNumber(String idNumber){
		mapper.deleteByIdNumber(idNumber);
	}
}